import { useState } from "react";

const useStateRef: any = (state: any, stateRef: any) => {
    const [data, setData] = useState(state);
    return [data, (value: any) => {
        setData(value);
        stateRef.current = value;
    }]
};

export default useStateRef;